<?php
namespace app\common\validate;
use think\Validate;
class User extends Validate
{
    protected $rule    = [
        'username' => 'require|length:2,30|unique:user,username',
        'password' => 'require|min:6',
        'repassword' => 'require|confirm:password',
    ];
    protected $message = [
        'username.require' => '用户名不能为空',
        'username.unique' => '用户名已经被注册',
        'username.length' => '用户名在6-20个字符之间',
        'password.require' => '密码不能为空',
        'password.min' => '密码最低6个字符',
        'repassword.require' => '确认密码不能为空',
        'repassword.confirm' => '两次密码不相符',
    ];
    //验证场景
    protected $scene = [
        'pwd'  =>  ['password','repassword'],
    ];
}
